﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Contract.aspx.cs" Inherits="Contract_Contract" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>查看合同请单</title>
    <link href="../CSS/others.css" rel="stylesheet" type="text/css" />
    <link href="../CSS/contract.css" type="text/css" rel="Stylesheet" />
    <link href="../CSS/bluedream.css" type="text/css" rel="Stylesheet" />    
    <script type="text/javascript" src="../Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="JS/popcalendar.js"></script>
    <script type="text/javascript" src="../Jscript/contract.js"></script>
    <link href="JS/jquery.uploadify-v2.1.4/uploadify.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="JS/jquery.uploadify-v2.1.4/swfobject.js"></script>
    <script type="text/javascript" src="JS/jquery.uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js"></script>
    <style type="text/css">
    .ddl{width:109%; margin-right: 0px; margin-top: 0px;}
    </style>
</head>
<body onload="setWidthHeight();">
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="600">
            <Services><asp:ServiceReference Path="~/webservice/contract/contractAddUpdateWebService.asmx" /></Services>
        </asp:ScriptManager>
        <div id="allDiv" style=" text-align:center;">
            <table cellpadding="0" class="topTable" cellspacing="0">
                <tr>
                    <td class="topTd">
                        <asp:Label ID="lblLocation" runat="server" Text="<%$ Resources:language, Location %>"></asp:Label><img
                            alt="当前位置" src="../Image/weizhi.gif" />>><asp:Label ID="Label1" runat="server" Text="合同信息"></asp:Label>
                    </td>
                </tr>
            </table>       
            <asp:UpdatePanel ID="updHead" runat="server">
               <ContentTemplate>       
                   <asp:UpdateProgress ID="UpdateProgress1" runat="server">    
                        <ProgressTemplate>
                            <div class="transp" style="text-align:center; padding: auto auto;">
                                <span style="font-size:25px; color:Blue;">Data Loading..... </span></div>              
                        </ProgressTemplate>
                   </asp:UpdateProgress>   
                   <fieldset><legend><font style="font-size: 12px">
                        <asp:Label ID="lblLegend1" runat="server" Text="<%$ Resources:language, Legend1 %>"></asp:Label></font></legend>
                        <table cellpadding="0" cellspacing="0" style="width:100%;" class="topHeadTable">
                            <tr>
                                <td class="trHeadFoot" colspan="6">
                                </td>
                            </tr>
                            <tr>
                                <td class="td5">
                                    &nbsp;</td>
                                <td class="td20">
                                    <asp:DropDownList ID="ddlCoDep" runat="server" AutoPostBack="True" 
                                        onselectedindexchanged="ddlCoDep_SelectedIndexChanged" Width="100%">
                                    </asp:DropDownList>
                                    </td>
                                <td class="td20">
                                    <asp:DropDownList ID="ddlcontractGroup" runat="server" AutoPostBack="True" 
                                        OnSelectedIndexChanged="ddlcontractGroup_ServerChange" Width="100%">
                                    </asp:DropDownList>
                                    </td>
                                <td class="td10">
                                    <asp:Label ID="Label20" runat="server" Text="合同号(ITT)"></asp:Label>
                                    </td>
                                <td class="td20">
                                    <input id="txtContractNo1" runat="server"
                                        class="txtStyle" type="text" runat="server" 
                                        style="width: 100%" />
                                    </td>
                                <td class="td25">
                                    <asp:Button ID="cmdSearch" runat="server" CssClass="cmdStyle" Enabled="False" 
                                        onclick="cmdSearch_Click" Text="<%$ Resources:language, CmdSearch %>" />
                                    <input type="button" id="queryMore" class="cmdStyle" onclick="show('queryForMore','block','gray')"
                                        value="高级查询" runat="server" disabled="disabled" />
                                </td>
                            </tr>
                            <tr>
                                <td class="td5">
                                    &nbsp;</td>
                                <td class="td20">
                                    <asp:DropDownList ID="ddlCNRSegment" runat="server" AutoPostBack="True" 
                                        onselectedindexchanged="ddlCNRSegment_SelectedIndexChanged" Width="100%">
                                    </asp:DropDownList>
                                </td>
                                <td class="td20">
                                    &nbsp;<asp:DropDownList ID="ddlCNRCoDe" runat="server" AutoPostBack="True" 
                                        onselectedindexchanged="ddlCNRCoDe_SelectedIndexChanged" Visible="False" 
                                        Width="100%">
                                    </asp:DropDownList>
                                </td>
                                <td class="td10">
                                    <asp:Label ID="Label4" runat="server" Text="合同号(ITT)"></asp:Label>
                                </td>
                                <td class="td20">
                                    <input id="txtContractNo" runat="server"
                                        class="txtStyle" type="text" runat="server" style="width: 100%" />
                                </td>
                                <td class="td25">
                                    <asp:Button ID="cmdNew" runat="server" CssClass="cmdStyle" Enabled="False" 
                                        onclick="cmdNew_Click" Text="新建" />
                                    <input type="button" id="cmdDelete" class="cmdStyle" onclick="DeleteContract();" value="删除" runat="server" />
                                    <input type="button" id="cmdDataUpdateFromDB" class="cmdStyle" 
                                        onclick="show('DataUpdateFromDiv','block','gray')" value="数据更新" runat="server" />
                                </td>
                            </tr>
                            <tr>
                                <td class="trHeadFoot" colspan="6">
                                </td>
                            </tr>
                        </table>
                        <asp:HiddenField runat="server" ID="hidQueryFlag" Value="0" />
                    </fieldset>
                   <div id="queryForMore" runat="server" style="display:none; overflow-x:auto; overflow-y:hidden;">
                     <fieldset><legend><font style="font-size: 12px">
                        <asp:Label ID="Label11" runat="server" Text="高级查询"></asp:Label></font></legend>             
                        <table border="0" cellpadding="0" cellspacing="0" style="width: 100%;" class="topHeadTable">                       
                            <tr>
                                <td colspan="8" class="trHeadFoot">
                                </td>
                            </tr>
                            <tr>
                                <td class="td10">
                                    </td>
                                <td class="td10">
                                    <asp:Label ID="Label10" runat="server" Text="客户名称:"></asp:Label></td>
                                <td class="td20">
                                    <asp:TextBox ID="txtCustomerName" runat="server" CssClass="txtStyleContract" 
                                        MaxLength="100"></asp:TextBox>
                                </td>
                                <td class="td5contract">
                                    &nbsp;</td>
                                <td class="td10">
                                    <asp:Label ID="Label6" runat="server" Text="销售员:"></asp:Label>
                                </td>
                                <td class="td20">
                                    <asp:TextBox ID="txtSaleName" runat="server" CssClass="txtStyleContract" 
                                        MaxLength="100"></asp:TextBox>
                                    <asp:DropDownList ID="ddlSaleName" runat="server" CssClass="ddl" 
                                        onblur="showHidden('ddlSaleName','ddlSaleName', 'txtSaleName','imgSaleName')" 
                                        onchange="showDdl('ddlSaleName','ddlSaleName', 'txtSaleName','imgSaleName')" 
                                        onselectedindexchanged="ddlSaleName_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                                <td class="td5contract">
                                    <img ID="imgSaleName" runat="server" alt="" 
                                        onmouseover="showHidden(this.id,'txtSaleName','ddlSaleName','ddlSaleName')" 
                                        src="../Image/ddl.jpg" />
                                </td>
                                <td class="td20">
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td class="td10">
                                    </td>
                                <td class="td10">
                                    <asp:Label ID="Label7" runat="server" Text="合同号(ITT):"></asp:Label></td>
                                <td class="td20">
                                    <asp:TextBox ID="txtContractNo2" runat="server" CssClass="txtStyleContract" 
                                        MaxLength="50"></asp:TextBox>                                
                                    </td>
                                <td class="td5contract" >
                                    &nbsp;</td>
                                <td class="td10">
                                    <asp:Label ID="Label9" runat="server" Text=" SO#  "></asp:Label>
                                </td>
                                <td class="td20">
                                    <asp:TextBox ID="txtSoNo" runat="server" CssClass="txtStyleContract" MaxLength="50"></asp:TextBox>
                                </td>
                                <td class="td5contract">
                                    &nbsp;</td>
                                <td class="td20">
                                </td>
                            </tr>
                            <tr>
                                <td class="td10">
                                    &nbsp;</td>
                                <td class="td10">
                                    <asp:Label ID="Label16" runat="server" Text="合同号(Customer):"></asp:Label>
                                </td>
                                <td class="td20">
                                    <asp:TextBox ID="txtContractNoCustomer" runat="server" CssClass="txtStyleContract" 
                                        MaxLength="50"></asp:TextBox>
                                </td>
                                <td class="td5contract">
                                    &nbsp;</td>
                                <td class="td10">
                                    <asp:Label ID="Label18" runat="server" Text="Plant SO#"></asp:Label>
                                </td>
                                <td class="td20">
                                    <asp:TextBox ID="txtPlantSoNo" runat="server" CssClass="txtStyleContract" 
                                        MaxLength="50"></asp:TextBox>
                                </td>
                                <td class="td5contract">
                                    &nbsp;</td>
                                <td class="td20">
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td class="td10">
                                    &nbsp;</td>
                                <td class="td10">
                                    <asp:Label ID="Label17" runat="server" Text="OH Name:"></asp:Label>
                                </td>
                                <td class="td20">
                                    <asp:TextBox ID="txtOHName" runat="server" CssClass="txtStyleContract" MaxLength="50"></asp:TextBox>
                                    <asp:DropDownList ID="ddlOHName" runat="server" CssClass="ddl" 
                                        onblur="showHidden('ddlOHName','ddlOHName', 'txtOHName','imgOHName')" 
                                        onchange="showDdl('ddlOHName', 'ddlOHName', 'txtOHName', 'imgOHName')" 
                                        ontextchanged="ddlOHName_TextChanged">
                                    </asp:DropDownList>
                                </td>
                                <td class="td5contract">
                                    <img ID="imgOHName" runat="server" alt="" 
                                        onmouseover="showHidden(this.id,'txtOHName','ddlOHName','ddlOHName')" 
                                        src="../Image/ddl.jpg" />
                                </td>
                                <td class="td10">
                                    <asp:Label ID="Label19" runat="server" Text="CE Name:"></asp:Label>
                                </td>
                                <td class="td20">
                                    <asp:TextBox ID="txtCEName" runat="server" CssClass="txtStyleContract" MaxLength="50"></asp:TextBox>
                                    <asp:DropDownList ID="ddlCEName" runat="server" CssClass="ddl" 
                                        onblur="showHidden('ddlCEName','ddlCEName', 'txtCEName','imgCEName')" 
                                        onchange="showDdl('ddlCEName','ddlCEName', 'txtCEName','imgCEName')" 
                                        ontextchanged="ddlCEName_TextChanged">
                                    </asp:DropDownList>
                                </td>
                                <td class="td5contract">
                                    <img ID="imgCEName" runat="server" alt="" 
                                        onmouseover="showHidden(this.id,'txtCEName','ddlCEName','ddlCEName')" 
                                        src="../Image/ddl.jpg" />
                                </td>
                                <td class="td20">
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td class="trHeadFoot" colspan="8">
                                </td>
                            </tr>
                        </table>      
                        <div class="cmdButtonsDiv">
                            <asp:Button ID="cmdQueryMore" runat="server" Text="高级查询"
                              CssClass="cmdStyle" onclick="cmdQueryMore_Click" />
                             &nbsp;<input type="button" id="Button4" class="cmdStyle" value="back" onclick="show('queryForMore','none','gray')" />
                        </div>
                     </fieldset>
                   </div>
                   <div id="DataUpdateFromDiv" style="width:99%; display:none;">
                       <table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;" class="topTdInput">                       
                            <tr>
                                <td class="td10" colspan="6" style="height: 3px">
                                </td>
                            </tr>
                            <tr style="display:none">
                                <td class="td10">
                                </td>
                                <td colspan="4" align="left">
                                    <asp:CheckBoxList ID="chkDateUpdate1" runat="server" 
                                        RepeatDirection="Horizontal" Enabled="False">
                                        <asp:ListItem Value="3" Selected="True">Order</asp:ListItem>
                                        <asp:ListItem Value="4" Selected="True">Customer</asp:ListItem>
                                        <asp:ListItem Value="5" Selected="True">Sales Catalog</asp:ListItem>
                                    </asp:CheckBoxList>
                                                        
                                </td>
                                <td class="td20">
                                </td>
                            </tr>
                            <tr>
                                <td class="td10">
                                    &nbsp;</td>
                                <td align="left" colspan="4">
                                    <asp:CheckBoxList ID="chkDateUpdate" runat="server" 
                                        RepeatDirection="Horizontal">
                                        <asp:ListItem Value="1">Trading</asp:ListItem>
                                        <asp:ListItem Value="2">Plant</asp:ListItem>
                                    </asp:CheckBoxList>
                                </td>
                                <td class="td20">
                                    &nbsp;</td>
                            </tr>
                            <tr style="display:none;"><%----%>
                                <td class="td10">
                                  </td>
                                <td colspan="4" style="text-align:left;">
                                    From  <input id="txtDateFrom" runat="server" class="txtStyle" name="date"
                                                     onclick="popUpCalendar(this,document.forms[0].txtDateFrom,'yyyy-mm-dd',this.id, 1)"
                                                            style="cursor: hand;width:200px;" type="text" />                              
                                    To <input id="txtDateTo" runat="server" class="txtStyle" name="date"
                                                     onclick="popUpCalendar(this,document.forms[0].txtDateTo,'yyyy-mm-dd',this.id, 1)"
                                                            style="width: 200px; cursor: hand" type="text" />
                                   </td>
                                <td class="td20">
                                   </td>
                            </tr>
                            <tr>
                                <td class="td10">
                                </td>
                                <td class="td20">
                                </td>
                                <td class="td10"><td class="td20">
                                    <asp:Button ID="cmdContractUpdateFromDB" runat="server" CssClass="cmdStyle" 
                                        onclick="cmdContractUpdateFromDB_Click" Text="Update" />
                                    &nbsp;<input type="button" id="Button3" class="cmdStyle" value="back" onclick="show('DataUpdateFromDiv','none','gray')" /></td>
                                </td>
                                <td class="td10">
                                </td>
                                <td class="td20">
                                </td>
                            </tr>
                            <tr>
                                <td class="td10" style="height:5px">
                                </td>
                                <td class="td20">
                                    </td>
                                <td class="td20">
                                </td>
                            </tr>
                        </table>
                   </div>
               </ContentTemplate> 
            </asp:UpdatePanel>
            <asp:UpdatePanel ID="updcontract" runat="server">
            <ContentTemplate>
                <fieldset>
                       <legend><font style="font-size: 12px;">
                            <asp:Label ID="lblLegend2" runat="server" Text="<%$ Resources:language, Legend2 %>"></asp:Label></font></legend>                
                       <div id="ShowLogDiv" style="text-align:center; vertical-align:middle; display:none;"></div>
                    <div id="viewLogDiv" style="position:absolute; height:100px;width:100px; display:none; z-index:1000; background-color:Gray; text-align:left; vertical-align:middle;" >
                    </div>
                    <div id="contractFileUpload" style="display:none;text-align:center;">
                    <fieldset id="filesUpload">
                    <legend><font style="font-size: 12px;"><asp:Label ID="Label14" runat="server" Text="Files Upload"></asp:Label></font></legend>   
                    <div id="fileQueue"></div>
                    <div id="selectFilesDiv"></div>
                    <table border="0" cellpadding="0" cellspacing="0" style="text-align:center;">
                    <tr>
                    <td></td>
                    <td style="width:300px; text-align:right;"><input type="file" name="uploadify" id="uploadify" value="0" /></td>
                    <td style="width:300px; text-align:left;"><input type="button" id="cmdContractFileUpload" value="上传" 
                        onclick="javascript:$('#uploadify').uploadifyUpload();ContractFileShow('',0)"/>
                        <input type="button" id="Button1" onclick="javascript:$('#uploadify').uploadifyClearQueue()" value="取消上传" />
                    </td>
                    <td></td>
                    </tr>                
                    </table>
                        <input type="text" id="textFileUploadNorRepeate" style="display:none;" value="0" />
                        <input type="text" id="forContractDeleteFlag" style="display:none;" value="0" />
                        <input type="text" id="forContractFilePath" style="display:none;" value="" />
                    </fieldset><div style="height:2px;"></div>
                    <fieldset id="filesDownLoad">
                    <legend><font style="font-size: 12px;"><asp:Label ID="Label15" runat="server" Text="Files DownLoad"></asp:Label></font></legend>   
                        <div id="filesDownLoadDiv" style="text-align:center;"></div>
                     </fieldset>
                     <div style="height:30px;"><input onclick="hidden('contractFileUpload')" type="button" id="cmdContractFileUploadBack" value="返回" /></div>
                    </div>            
                        <div class="menuContractListDiv" id="menuContractList" style="overflow-y: auto; overflow-x: scroll; background-color:#D3E4E5;">
                           <fieldset id="fieldsetShowAddRepeat" style="display:none;">
                            <legend><font style="font-size: 12px;">
                                <asp:Label ID="Label13" runat="server" Text="For Repeate"></asp:Label></font></legend> 
                                <div id="ShowAddRepeatDiv" style="overflow-y: auto; overflow-x: scroll;"><label id="lblShowAddRepeatDiv" style="display:none;"></label>
                                <input type="button" id="dsfsa" onclick="hidden('fieldsetShowAddRepeat')" class="cmdStyle" value="返回" />
                                </div>
                           </fieldset>
                            <%= getContract()%>
                        </div>                  
                        <input type="text" style="width:0px; height:0px; display:none;" id="txtForDateFlag" value="0" />
                        <input type="text" style="width:0px; height:0px; display:none;" id="txtForDate" value="0" />
                        <input type="text" style="width:0px; height:0px; display:none;" id="refresh" value="0" />
                        <script language="javascript" type="text/javascript">
                            function ContractUpdateForeDate(n, td, strID, contractNoMain, columnID, coCode, userCode) {
                                if (n == 1) {
                                    document.getElementById("txtForDate").value = document.getElementById(strID).value;
                                }
                                else {
                                    // window.alert("get in");
                                    var aa = document.getElementById(strID).value;
                                    var bb = document.getElementById("txtForDate").value;
                                    var flag = document.getElementById("txtForDateFlag").value;
                                    //window.alert(flag);
                                    if (aa != bb || flag == 0) {
                                        updateORinsert(td, aa, contractNoMain, columnID, coCode, userCode);
                                        //window.alert("update");
                                    }
                                }
                            }
                            function forAlter(str) {
                                alert(str);
                            }
                        </script>
                       <div id="test"></div> 
                </fieldset>    
                <div >
                    <table>
                        <tr>
                            <td style="text-align:left;">
                                <asp:Label ID="Label8" runat="server" Text="每页显示数据"></asp:Label>
                                <asp:DropDownList ID="ddlPageSize" runat="server" Width="50px" 
                                    AutoPostBack="True" onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
                                <asp:ListItem Value="5" Text="5"></asp:ListItem>
                                <asp:ListItem Selected="True" Value="10" Text="10"></asp:ListItem>
                                <asp:ListItem Value="15" Text="15"></asp:ListItem>
                                <asp:ListItem Value="20" Text="20"></asp:ListItem>
                                <asp:ListItem Value="25" Text="25"></asp:ListItem>
                                </asp:DropDownList>,
                                         
                                <asp:Label ID="lblTotal0" runat="server" Text="<%$ Resources:UserSqlPage, Total1 %>"></asp:Label>
                                <asp:Label ID="lblTotal" runat="server"></asp:Label>

                                <asp:Label ID="Total2" runat="server" Text="<%$ Resources:UserSqlPage, Total2 %>"></asp:Label>,
                                <asp:Label ID="Label5" runat="server" Text="<%$ Resources:UserSqlPage, CurrentPage1 %>"></asp:Label>
                                <asp:Label ID="lblPageIndex" runat="server" Text='1'></asp:Label>
                                <asp:Label ID="Label2" runat="server" Text="<%$ Resources:UserSqlPage, CurrentPage2 %>"></asp:Label>,
                                <asp:Label ID="Label3" runat="server" Text="<%$ Resources:UserSqlPage, TotalPage1 %>"></asp:Label>
                                <asp:Label ID="lblPageCount" runat="server" Text='1'></asp:Label>
                                <asp:Label ID="Label12" runat="server" Text="<%$ Resources:UserSqlPage, TotalPage2 %>"></asp:Label>
                                <% //首页/上一页 %>
                                <asp:LinkButton ID="lbtFirstPage" runat="server" Enabled="false" 
                                    Text="<%$ Resources:UserSqlPage, FirstPage %>" onclick="lbtFirstPage_Click" />&nbsp;
                                <asp:LinkButton ID="lbtPreviousPage" runat="server" Enabled="false" 
                                    Text="<%$ Resources:UserSqlPage, PreviousPage %>" 
                                    onclick="lbtPreviousPage_Click" />&nbsp;
                                        
                                <% //下一页/尾页 %>
                                <asp:LinkButton ID="lbtNextPage" runat="server" Enabled="false" 
                                    Text="<%$ Resources:UserSqlPage, NextPage %>" onclick="lbtNextPage_Click" />&nbsp;
                                <asp:LinkButton ID="lbtLastPage" runat="server" Enabled="false" 
                                    Text="<%$ Resources:UserSqlPage, LastPage %>" onclick="lbtLastPage_Click" />
                                        
                                <input type="text" id="txtNewPageIndex" runat="server" value="" onblur="checkNumMax(txtIsNumber(this.id))" style="width:25px" />
                                <asp:LinkButton ID="btnGo" runat="server" Text="<%$ Resources:UserSqlPage, PageGo %>" onclick="btnGo_Click"></asp:LinkButton>
                                        
                                <asp:Label ID="lblMessage" runat="server" Font-Size="14px" ForeColor="#FF3300"></asp:Label>
                                        
                            </td>
                        </tr>
                    </table>            
                </div>
            </ContentTemplate> 
            </asp:UpdatePanel>
        </div>
        <div id="overAllDiv" style="height:0px;">   
        </div>
        <p>
        <input id="Text1" type="text" style="display:none; background-color:White" /></p> 
        <%--<script language="javascript" type="text/javascript">
                    Sys.Application.add_load(
             function () {
                 var form = Sys.WebForms.PageRequestManager.getInstance()._form;
                 form._initialAction = form.action = window.location.href;
             }
        );
        </script>--%> 
       </form>
</body>
</html>